import asyncio
from contentforge.core.model_factory import ModelFactory, ModelType
from contentforge.core.model_interface import ModelConfig

def main():
    # OpenAI配置（完整版）
    openai_config = ModelConfig(
        api_key="your_openai_key",
        api_base="https://api.openai.com/v1",  # 可选
        model_name="gpt-4",  # 指定具体模型
        max_tokens=4096,
        temperature=0.7,
        proxy="http://your-proxy:port",  # 可选代理
        extra_config={
            "top_p": 0.9,  # 额外模型参数
            "frequency_penalty": 0.5
        }
    )
    
    # Claude配置
    claude_config = ModelConfig(
        api_key="your_claude_key",
        api_base="https://api.anthropic.com",  # 可选自定义基础URL
        model_name="claude-3-opus-20240229"
    )
    
    # Kimi配置
    kimi_config = ModelConfig(
        api_key="your_kimi_key",
        api_base="https://api.moonshot.cn/v1",
        model_name="moonshot-v1-8k"
    )
    
    # 创建模型实例
    openai_model = ModelFactory.create_model(ModelType.OPENAI, openai_config)
    claude_model = ModelFactory.create_model(ModelType.CLAUDE, claude_config)
    kimi_model = ModelFactory.create_model(ModelType.KIMI, kimi_config)
    
    # 使用示例
    messages = [
        {"role": "user", "content": "介绍一下人工智能的发展历程"}
    ]
    
    openai_result = openai_model.generate_text(messages)
    claude_result = claude_model.generate_text(messages)
    kimi_result = kimi_model.generate_text(messages)
    
    print("OpenAI:", openai_result)
    print("Claude:", claude_result)
    print("Kimi:", kimi_result)

main()
